{include file="public/header" /}

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">

                <div class="layui-card-header">
                    <button class="layui-btn layui-bg-cyan layui-btn-sm"
                        onclick="open_add('添加评论','compent_add?goodsid={:input('get.id')}')">添加评论</button>
                    共有数据：<strong id="count">{$list->total()}</strong> 条
                </div>
                <div class="layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                            <tr>
                                <th>
                                    <div class="layui-table-cell">ID</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">评价用户</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">规格</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">星级</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">评价</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">图片</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">时间</div>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            {foreach $list as $v}
                            <tr>
                                <td>
                                    <div class="layui-table-cell">{$v.id|default=''}</div>
                                </td>
                                <td>
                                    <div><img style="height: 40px;" src="{$v.user.avatarUrl|default=''}"
                                            alt="{$v.user.nickName|default=''}">
                                    </div>
                                    <div class="layui-table-cell">{$v.user.nickName|default=''}</div>
                                </td>
                                <td>
                                    <div class="layui-table-cell">{$v.spec_name|default=''}</div>
                                </td>
                                <td>
                                    <div class="layui-table-cell">{$v.star|default='1'}星</div>
                                </td>
                                <td>
                                    <div class="layui-table-cell">{$v.text|default='1'}星</div>
                                </td>
                                <td>
                                    <div id="layer-photos-demo" class="layer-photos-demo">
                                        {if !empty($v.images)}
                                        {foreach $v.images as $k=> $vs}
                                        <img layer-pid="" style="height: 40px;" layer-src="{$vs|default=''}"
                                            src="{$vs|default=''}" alt="{$v.spec_name|default=''}">
                                        {/foreach}
                                        {/if}
                                    </div>
                                </td>
                                <td>
                                    <div class="layui-table-cell">{$v.created|default=''}</div>
                                </td>
                            </tr>
                            {/foreach}

                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        {$list->render()|raw}
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
</body>
<script>
    function money_edit(title, url, id) {
        layer.prompt({
            formType: 0,
            value: 0,
            title: title,
        }, function (value, index, elem) {
            $.ajax({
                type: 'post',
                url: url,
                data: { id: id, money: value },
                success: function (res) {
                    if (res.code == 0) {
                        layer.msg(res.msg, { icon: 6, time: 1000 }, function () {
                            layer.close(index);
                            // 获得frame索引
                            location.reload();
                        });
                    } else {
                        layer.msg(res.msg, { icon: 2, time: 1000 });
                    }
                }
            });
            return false;

        });
    }
    layui.use(['form', 'upload'], function () {
        var $ = layui.jquery
            , form = layui.form
            , layer = layui.layer;
    });
</script>
<script>
    layer.photos({
        photos: '#layer-photos'
        , anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
    });
</script>
{include file="public/footer"}